{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "65a2ce13",
   "metadata": {},
   "source": [
    " week01  \n",
    "* 下载anaconda    \n",
    "* 尝试运行Python第一行代码print\"hello world\"  \n",
    "* 观察标准库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a364d226",
   "metadata": {},
   "source": [
    "## 函数+模块=标准库"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "859da751",
   "metadata": {},
   "source": [
    "## 观察标准库"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "7c400eb6",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'win32'"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import sys\n",
    ">>> sys.platform  #sys模块可以了解运行解释器的系统"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "9a9ad3a1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]\n"
     ]
    }
   ],
   "source": [
    ">>> print(sys.version) #了解运行Python的哪个版本"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "5cc29c03",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'D:\\\\gitee笔记\\\\python-note'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import os #在os模块中调用函数\n",
    ">>> os.getcwd() #调用getcwd函数会返回当前工作目录，帮助找出代码所在文件夹名字"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "4bd36dcc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "environ{'ALLUSERSPROFILE': 'C:\\\\ProgramData',\n",
       "        'APPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Roaming',\n",
       "        'COMMONPROGRAMFILES': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMMONPROGRAMFILES(X86)': 'C:\\\\Program Files (x86)\\\\Common Files',\n",
       "        'COMMONPROGRAMW6432': 'C:\\\\Program Files\\\\Common Files',\n",
       "        'COMPUTERNAME': 'OS-20210216XAYQ',\n",
       "        'COMSPEC': 'C:\\\\Windows\\\\system32\\\\cmd.exe',\n",
       "        'DEVMGR_SHOW_DETAILS': '1',\n",
       "        'DRIVERDATA': 'C:\\\\Windows\\\\System32\\\\Drivers\\\\DriverData',\n",
       "        'FPS_BROWSER_APP_PROFILE_STRING': 'Internet Explorer',\n",
       "        'FPS_BROWSER_USER_PROFILE_STRING': 'Default',\n",
       "        'HOMEDRIVE': 'C:',\n",
       "        'HOMEPATH': '\\\\Users\\\\Administrator',\n",
       "        'INTEL_DEV_REDIST': 'C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Libraries\\\\',\n",
       "        'LOCALAPPDATA': 'C:\\\\Users\\\\Administrator\\\\AppData\\\\Local',\n",
       "        'LOGONSERVER': '\\\\\\\\OS-20210216XAYQ',\n",
       "        'MIC_LD_LIBRARY_PATH': 'C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Libraries\\\\compiler\\\\lib\\\\mic',\n",
       "        'NUMBER_OF_PROCESSORS': '12',\n",
       "        'OS': 'Windows_NT',\n",
       "        'PATH': 'D:\\\\python\\\\anaconda;D:\\\\python\\\\anaconda\\\\Library\\\\mingw-w64\\\\bin;D:\\\\python\\\\anaconda\\\\Library\\\\usr\\\\bin;D:\\\\python\\\\anaconda\\\\Library\\\\bin;D:\\\\python\\\\anaconda\\\\Scripts;C:\\\\Program Files (x86)\\\\Common Files\\\\Intel\\\\Shared Libraries\\\\redist\\\\intel64\\\\compiler;C:\\\\Windows\\\\system32;C:\\\\Windows;C:\\\\Windows\\\\System32\\\\Wbem;C:\\\\Windows\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\;C:\\\\Windows\\\\System32\\\\OpenSSH\\\\;C:\\\\Program Files (x86)\\\\NVIDIA Corporation\\\\PhysX\\\\Common;C:\\\\Program Files\\\\NVIDIA Corporation\\\\NVIDIA NvDLISR;C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\Microsoft\\\\WindowsApps;C:\\\\Users\\\\Administrator\\\\AppData\\\\Local\\\\GitHubDesktop\\\\bin;C:\\\\ProgramData\\\\Administrator\\\\GitHubDesktop\\\\bin;D:\\\\python\\\\PyCharm Community Edition with Anaconda plugin 2020.2.1\\\\bin;;D:\\\\软件\\\\PyCharm 2021.2.1\\\\bin;',\n",
       "        'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',\n",
       "        'PROCESSOR_ARCHITECTURE': 'AMD64',\n",
       "        'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 165 Stepping 2, GenuineIntel',\n",
       "        'PROCESSOR_LEVEL': '6',\n",
       "        'PROCESSOR_REVISION': 'a502',\n",
       "        'PROGRAMDATA': 'C:\\\\ProgramData',\n",
       "        'PROGRAMFILES': 'C:\\\\Program Files',\n",
       "        'PROGRAMFILES(X86)': 'C:\\\\Program Files (x86)',\n",
       "        'PROGRAMW6432': 'C:\\\\Program Files',\n",
       "        'PROMPT': '$P$G',\n",
       "        'PSMODULEPATH': 'C:\\\\Program Files\\\\WindowsPowerShell\\\\Modules;C:\\\\Windows\\\\system32\\\\WindowsPowerShell\\\\v1.0\\\\Modules',\n",
       "        'PUBLIC': 'C:\\\\Users\\\\Public',\n",
       "        'PYCHARM': 'D:\\\\软件\\\\PyCharm 2021.2.1\\\\bin;',\n",
       "        'PYCHARM COMMUNITY EDITION WITH ANACONDA PLUGIN': 'D:\\\\python\\\\PyCharm Community Edition with Anaconda plugin 2020.2.1\\\\bin;',\n",
       "        'SESSIONNAME': 'Console',\n",
       "        'SYSTEMDRIVE': 'C:',\n",
       "        'SYSTEMROOT': 'C:\\\\Windows',\n",
       "        'TEMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp',\n",
       "        'TMP': 'C:\\\\Users\\\\ADMINI~1\\\\AppData\\\\Local\\\\Temp',\n",
       "        'USERDOMAIN': 'OS-20210216XAYQ',\n",
       "        'USERDOMAIN_ROAMINGPROFILE': 'OS-20210216XAYQ',\n",
       "        'USERNAME': 'Administrator',\n",
       "        'USERPROFILE': 'C:\\\\Users\\\\Administrator',\n",
       "        'WINDIR': 'C:\\\\Windows',\n",
       "        'ZES_ENABLE_SYSMAN': '1',\n",
       "        'JPY_INTERRUPT_EVENT': '2476',\n",
       "        'IPY_INTERRUPT_EVENT': '2476',\n",
       "        'JPY_PARENT_PID': '2452',\n",
       "        'TERM': 'xterm-color',\n",
       "        'CLICOLOR': '1',\n",
       "        'PAGER': 'cat',\n",
       "        'GIT_PAGER': 'cat',\n",
       "        'MPLBACKEND': 'module://ipykernel.pylab.backend_inline'}"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> os.environ #使用environ属性，可以访问系统的全部环境变量/也可使用getenv单独访问某一个环境变量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3437dd7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2021, 10, 2)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import datetime\n",
    ">>> datetime.date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "efb1726e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.today().day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "61efa5ee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "10"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.today().month"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "18efc22d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2021"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.today().year"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "f57ee06c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2021-10-03'"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> datetime.date.isoformat(datetime.date.today()) #调用date.isoformat函数，将今天日期转换为一个字符串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "08172ec3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'00 14'"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> import time\n",
    ">>> time.strftime(\"%H:%M\") #time模块，strftime函数，24小时制的当前小时（%H）和分钟（%M）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "9780c82b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Sunday AM'"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    ">>> time.strftime(\"%A %p\") #星期几，上午还是下午"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1d91e6bb",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
